# -*- coding: utf-8 -*-
# @Time : 2021/9/9 17:25
# @Author : hello
# @Email : xxx@gmail.com
# @File : CRM_ST_KHGL_002.py
# @Project : crm

from selenium import webdriver
from time import sleep

from selenium.webdriver.common.by import By

"""线索模块-验证添加功能-非必填项为空，必填项（联系人、手机）合法输入"""
driver=webdriver.Chrome()
try:
    driver.implicitly_wait(30)
    driver.maximize_window()
    """前置条件-已进入线索添加界面"""
    cookies = {'name': 'PHPSESSID', 'value': 'bmvd5seffcgjo6521e77l3ld16'}
    driver.get("http://192.168.1.155")
    driver.add_cookie(cookies)
    driver.get("http://192.168.1.155/crm/index.php?m=leads&a=add")

    lxrs="张三"
    phones="15632455632"

    lxr=(By.ID,'contacts_name')
    phone=(By.ID,'mobile')
    bc=(By.CSS_SELECTOR,'input[value="保存"]')

    driver.find_element(*lxr).send_keys(lxrs)
    driver.find_element(*phone).send_keys(phones)
    sleep(5)
    driver.find_element(*bc).click()

except Exception as e:
    raise e
finally:
    sleep(3)
    # driver.quit()
